home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
batch
/
beeper1
/
beeper.asm
< prev
next >
Wrap
Assembly Source File
|
1991-06-04
|
2KB
|
78 lines
; BEEPER.COM by Duane Paulson 06/05/91.
; Beeps once a second until a key is pressed.
; Created using comtemp.asm template by Chuck Nelson; (c) NELSOFT Software.
; All rights reserved. Used by permission.
; Comtemp.asm is included in The PC Assembler Helper and Tutor by
; Chuck Nelson, downloadable as "PCTUTOR.xxx".
COMSEG SEGMENT PUBLIC 'CODE'
ASSUME cs:COMSEG, ds:COMSEG, es:COMSEG, ss:COMSEG
ORG 100h
main proc NEAR
start: mov ax,0E07h ; TTY output - ascii 7 (beep)
mov bh,0 ; primary video page
int 10h ; call bios
main_loop:
mov ah,0 ; get system timer
int 01Ah ; call bios
; system timer returns a double word (32 bits).
; since we're only waiting for one second,
; looking at the low word will suffice.
add dx,18 ; add 18 to low word (timer ticks 18 times/sec)
mov low_timer,dx ; store low word
wayt: mov ah,0Bh ; check for character waiting
int 21h ; call dos
cmp al,0FFh ; character waiting?
je clear_buffer ; then exit
mov ah,0 ; get system timer
int 01Ah ; call bios
cmp dx,low_timer ; compare low word to low_timer
jb wayt ; loop for 1 second
mov ax,0E07h ; TTY output - ascii 7 (beep)
mov bh,0 ; primary video page
mov cx,1 ; display 1 character
int 10h ; call bios
mov ah,0Bh ; check for character waiting
int 21h ; call dos
cmp al,0 ; no keypress?
je main_loop ; then loop
clear_buffer:
mov ah,7 ; Character input without echo
int 21h ; call dos
mov ah,0Bh ; check for character waiting
int 21h ; call dos
cmp al,0FFh ; character waiting?
je clear_buffer ; then loop
mov ax,4C00h ; exit with 0 exit code
int 21h ; call dos and exit
ret
main endp
low_timer dw ?
COMSEG ENDS
END start